package com.zk5_education.Controller;

import com.zk5_education.Service.OssService;
import com.zk5_education.R;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
@Api(description="阿里云文件管理")
@RestController
@RequestMapping("/eduOss/fileUpload" )
@CrossOrigin
public class OssController {

    @Autowired
    OssService ossService;

        @PostMapping("/avaterUpload")
    public R uploadFile(MultipartFile file){

        //头像存储路径
        String url=ossService.uploadFileAvatar(file);

        return  R.success().data("url",url);

    }
}
